package Month9.pojo;

import java.util.ArrayList;

public class sqlist
{
    private ArrayList<Character> list ;

    public sqlist()
    {
        list = new ArrayList<>();
    }
    public void insert(char in)
    {
        list.add(in);
    }

    public ArrayList<Character> getList()
    {
        return list;
    }
    public void show()
    {
        int i = 0 ;
        for(char c :list)
        {
            System.out.print((char)c);
            i++;
        }
        System.out.println();
    }

    public boolean isNull()
    {
        if(list.isEmpty())
        {
            return true;
        }
        return false;
    }

    public char findCharByIndex(int index)
    {
        return list.get(index);
    }
    public int findIndexByChar(char ch)
    {
        for(int i = 0 ; i < list.size() ; i ++)
        {
            if(list.get(i) == ch)
            {
                return i;
            }
        }
        return -1;
    }
    public void change(int index , char ch)
    {
        list.set(index,ch);
    }
    public void remove(int index)
    {
        list.remove(index);
    }

}
